*** Data merge files for Replication files for  Jakana L. Thomas. 2022. ``Sisters Are Doing it for Themselves: How Female Combatants Help Generate Gender-Inclusive Peace Agreements in Civil Wars" at American Political Science Review.***

**import PAX peace agreement dataset"

import delimited "pax_data_1728_agreements_2_2_23.csv", bindquote(strict) maxquotedrows(2000) clear 
rename con country

*merge pax gender data
joinby agtid year using "gender_PAX.dta", unmatched(master)
rename _merge merge1

**merge Wood and Thomas 2018 WARD DATA*

gen UcdpCon_real =real(ucdpcon)
rename UcdpCon_real UcdpCon
joinby UcdpCon using  "WARD conflict level.dta", unmatched(master)
drop if UcdpCon==.
gen conflict_id=UcdpCon
gen cowcode= loc1gwno
rename _merge merge2

joinby conflict_id using "ward_update_conflict_level.dta", unmatched (master)

**merge Hughes et al Women INGO dataset
rename _merge merge2_2

joinby cowcode year using "WINGO_data_final.dta", unmatched(master)

**merge Mudie and Peksen's data
rename _merge merge3
joinby cowcode year using "Murdie_Women_NGO.dta", unmatched(master)

**merge UN intervention, Major party, Third party intervention-- data coded by hand from PAX database
rename _merge merge4
joinby agtid year using  "PAX_intervention_data.dta", unmatched(master)

**merge V-dem women's equality dataset (dropped if cowcode=-.)

rename _merge merge5
joinby cowcode year using "Women_vdem.dta", unmatched(master)


**merge FORGE  data
rename _merge merge8
joinby conflict_id using  "forge_conflict_level.dta", unmatched(master)

*gen intrastate agreement
gen internationalized=0
replace internationalized=1 if agtp=="InterIntra"
replace internationalized=. if agtp==""
gen interstateonly=0 
replace interstateonly=1 if agtp=="Inter"
gen inter_intrastate=0 
replace inter_intrastate=1 if agtp=="InterIntra"

***any DDR provision
gen ssrddr_binary=.
replace ssrddr_binary=0 if ssrddr==0
replace ssrddr_binary=1 if ssrddr~=0 & ssrddr~=.

**gendered DDR binary
gen wggddr_binary=.
replace wggddr_binary=0 if wggddr==0
replace wggddr_binary=1 if wggddr~=0 &wggddr~=.


***gender equality generic
gen eqgen_binary=.
replace eqgen_binary=0 if eqgen==0 & eqgen==~.
replace eqgen_binary=1 if eqgen~=0 & eqgen~=.
gen wggeqgen_binary=.
replace wggeqgen_binary=0 if wggeqgen==0 & wggeqgen~=.
replace wggeqgen_binary=1 if wggeqgen~=0 & wggeqgen~=.




***combine equality provisions (independent variable)

gen exc_eq=0
replace exc_eq=0 if wggeq==0 &wgggrp==0
replace exc_eq=1 if wggeq==1| wgggrp==1


****combine DDR provisions (independent variable)
gen gen_ddr=0 if ssrddr~=.
replace gen_ddr=1 if wggddr==1

gen Allddr=0
replace Allddr=1 if gen_ddr==1| wggrehab==1
replace Allddr=. if wggrehab==. & gen_ddr==.


**coding for Krause female signatories across 6 conflicts: DRC 2003, El Salvador 1992, Guatemala 1996, Liberia 2003, Papua New Guinea 2001; Uk/northern ireland 1998

gen Krause_wpm_neg=0
replace Krause_wpm_neg=1 if country=="Democratic Republic of Congo" & year==2003
replace Krause_wpm_neg=1 if country=="El Salvador" & year== 1992
replace Krause_wpm_neg=1 if country=="Guatemala" & year==1996
replace Krause_wpm_neg=1 if country=="Liberia" & year==2003
replace Krause_wpm_neg=1 if country=="Papua New Guinea/(Bougainville)"|country=="Papua New Guinea/Bougainville" & year==2001
replace Krause_wpm_neg=1 if country== "Ireland/United Kingdom/(Northern Ireland)" | country=="Ireland/United Kingdom/Northern Ireland" & year== 1998
replace Krause_wpm_neg=. if year>2011

*recoding marginalization and equality variables

gen discrimination_all=0
replace discrimination_all=1 if agtid==1415
replace discrimination_all=1 if agtid==384
replace discrimination_all=1 if agtid==389
replace discrimination_all=1 if agtid==1198
replace discrimination_all=1 if agtid==608
replace discrimination_all=1 if agtid==472
replace discrimination_all=1 if agtid==1469
replace discrimination_all=1 if agtid==1421
replace discrimination_all=1 if agtid==1425
replace discrimination_all=1 if agtid==306
replace discrimination_all=1 if agtid==2258
replace discrimination_all=1 if agtid==1442
replace discrimination_all=1 if agtid==1659
replace discrimination_all=1 if agtid==1845
replace discrimination_all=1 if agtid==1547
replace discrimination_all=1 if agtid==1392
replace discrimination_all=1 if agtid==815
replace discrimination_all=1 if agtid==812
replace discrimination_all=1 if agtid==163
replace discrimination_all=1 if agtid==1173
replace discrimination_all=1 if agtid==793
replace discrimination_all=1 if agtid==671
replace discrimination_all=1 if agtid==672
replace discrimination_all=1 if agtid==404
replace discrimination_all=1 if agtid==1303
replace discrimination_all=1 if agtid==474
replace discrimination_all=1 if agtid==284
replace discrimination_all=1 if agtid==292
replace discrimination_all=1 if agtid==291
replace discrimination_all=1 if agtid==283
replace discrimination_all=1 if agtid==273
replace discrimination_all=1 if agtid==343
replace discrimination_all=1 if agtid==1422
replace discrimination_all=1 if agtid==2270
replace discrimination_all=1 if agtid==1435
replace discrimination_all=1 if agtid==556
replace discrimination_all=1 if agtid==985
replace discrimination_all=1 if agtid==688
replace discrimination_all=1 if agtid==405
replace discrimination_all=1 if agtid==1661
replace discrimination_all=1 if agtid==1370
replace discrimination_all=1 if agtid==728
replace discrimination_all=1 if agtid==425
replace discrimination_all=1 if agtid==426
replace discrimination_all=1 if agtid==214
replace discrimination_all=1 if agtid==2369
replace discrimination_all=1 if agtid==1518
replace discrimination_all=1 if agtid==1321
replace discrimination_all=1 if agtid==1361
replace discrimination_all=1 if agtid==1749
replace discrimination_all=1 if agtid==1322
replace discrimination_all=1 if agtid==333
replace discrimination_all=1 if agtid==87
replace discrimination_all=1 if agtid==1406
replace discrimination_all=1 if agtid==1417
replace discrimination_all=1 if agtid==1979
replace discrimination_all=1 if agtid==335
replace discrimination_all=1 if agtid==933
replace discrimination_all=1 if agtid==867
replace discrimination_all=1 if agtid==866
replace discrimination_all=1 if agtid==479
replace discrimination_all=1 if agtid==1343
replace discrimination_all=1 if agtid==504
replace discrimination_all=1 if agtid==503
replace discrimination_all=1 if agtid==1360
replace discrimination_all=1 if agtid==407
replace discrimination_all=1 if agtid==186
replace discrimination_all=1 if agtid==1357
replace discrimination_all=1 if agtid==1967
replace discrimination_all=1 if agtid==1800
replace discrimination_all=1 if agtid==337
replace discrimination_all=1 if agtid==498
replace discrimination_all=1 if agtid==385
replace discrimination_all=1 if agtid==440
replace discrimination_all=1 if agtid==550
replace discrimination_all=1 if agtid==1012
replace discrimination_all=1 if agtid==1010
replace discrimination_all=1 if agtid==1280
replace discrimination_all=1 if agtid==1007
replace discrimination_all=1 if agtid==2325
replace discrimination_all=1 if agtid==2374
replace discrimination_all=1 if agtid==2243
replace discrimination_all=1 if agtid==1060
replace discrimination_all=1 if agtid==853
replace discrimination_all=1 if agtid==753
replace discrimination_all=1 if agtid==350
replace discrimination_all=1 if agtid==1264
replace discrimination_all=1 if agtid==888
replace discrimination_all=1 if agtid==1400
replace discrimination_all=1 if agtid==1340
replace discrimination_all=1 if agtid==826
replace discrimination_all=. if gewom==.


gen gen_discrimination=0
replace gen_discrimination=1 if agtid==2258
replace gen_discrimination=1 if agtid==1547
replace gen_discrimination=1 if agtid==1845
replace gen_discrimination=1 if agtid==815
replace gen_discrimination=1 if agtid==163
replace gen_discrimination=1 if agtid==404
replace gen_discrimination=1 if agtid==284
replace gen_discrimination=1 if agtid==273
replace gen_discrimination=1 if agtid==1361
replace gen_discrimination=1 if agtid==2325
replace gen_discrimination=1 if agtid==1400

gen gen_exclusion=0
replace gen_exclusion=1 if agtid==2258
replace gen_exclusion=1 if agtid==1845
replace gen_exclusion=1 if agtid==817
replace gen_exclusion=1 if agtid==1361
replace gen_exclusion=1 if agtid==2325
replace gen_exclusion=1 if agtid==1400

gen gen_marginalized=0
replace gen_marginalized=1 if agtid==1845
replace gen_marginalized=1 if agtid==1547
replace gen_marginalized=1 if agtid==815
replace gen_marginalized=1 if agtid==163
replace gen_marginalized=1 if agtid==273
replace gen_marginalized=1 if agtid==2325
replace gen_marginalized=1 if agtid==1400

gen gen_minority=0
replace gen_minority=1 if agtid==2258
replace gen_minority=1 if agtid==163
replace gen_minority=1 if agtid==1361
replace gen_minority=1 if agtid==1400

gen gen_inclusion=0
replace gen_inclusion=1 if agtid==1845
replace gen_inclusion=1 if agtid==1547
replace gen_inclusion=1 if agtid==815
replace gen_inclusion=1 if agtid==163
replace gen_inclusion=1 if agtid==1361
replace gen_inclusion=1 if agtid==1400
replace gen_inclusion=1 if agtid==2325

gen marginalized_excluded= 0
replace marginalized_excluded=1 if gen_discrimination==1
replace marginalized_excluded=1 if  gen_exclusion==1 
replace marginalized_excluded=1 if gen_marginalized==1 
replace marginalized_excluded=1 if gen_minority==1 
replace marginalized_excluded=1 if gen_inclusion==1

replace wggdev=0 if wggdev==. & gewom~=.
replace wggedu=0 if wggedu==. & gewom~=.
replace wgghea=0 if wgghea==. & gewom~=.
replace wggeq=0 if wggeq==. & gewom~=. 
replace wggsoceq=0 if wggsoceq==. & gewom~=.
replace wgggrp=0 if wgggrp==. & gewom~=.

*recoding integration measures

replace wggddr=0 if wggddr==. & gewom~=.
replace wggrehab=0 if wggrehab==. & gewom~=.
 
 *gen variables for Nepal and Colombia (potential outliers)


gen colombia=1 if cowcode==100
replace colombia=0 if cowcode~=100

gen nepal=1 if cowcode==790
replace nepal=0 if cowcode~=790

*merging PAX with UCDP PA database  *info to below referenced generate data set in file named "PAID to AGTID.do"
rename _merge merge10

gen new_conflictid= conflict_id

joinby agtid year using "UCDP_PA_data_final.dta", unmatched(master)


*coding substantive agreements 

gen substantive=0
replace substantive=1 if stage=="SubPar"
replace substantive=1 if stage=="SubComp"


**International influence 

*UN women established in 2010
gen UNwomen=0
replace UNwomen=1 if year>2009
replace UNwomen=0 if year==2010 & month<8
*UN sec council res 1325 passed in 2000
gen UN1325=0
replace UN1325=1 if year>1999
replace UN1325=0 if year==2000 & month<10

*beijing declaration in 1995
gen beijing=0
replace beijing=1 if year>1994


**merging data on official development assistance
rename _merge merge12
joinby cowcode year using "netODA.dta", unmatched(master)
replace net_ODA=0 if net_ODA==.
rename _merge merge13
joinby cowcode year using "ODA_women_final.dta", unmatched(master)
replace ODA_women=0 if ODA_women==.
replace ODA_women=. if year<2002
replace ODA=0 if ODA==.

 **merge WB gender; data processing information in file: "WB_gender.do"
rename _merge merge14
joinby cowcode year using "WB_gender_final.dta", unmatched(master)

rename _merge merge15
joinby cowcode year using "WB_parliament.dta", unmatched(master)
rename women_parliament women_parliament_current

*** alternate operationalizations of female combatant prevalence ***


gen low=.
replace low=0 if cat4_prevalence_best==0
replace low= 1 if cat4_prevalence_best==1
replace low= 0 if cat4_prevalence_best==2
replace low= 0 if cat4_prevalence_best==3

	  
gen high_moderate=.
replace high_moderate= 0 if cat4_prevalence_best==0
replace high_moderate= 0 if cat4_prevalence_best==1
replace high_moderate= 1 if cat4_prevalence_best==2
replace high_moderate= 1 if cat4_prevalence_best==3


gen none=.
replace none=1 if cat4_prevalence_best==0
replace none=0 if cat4_prevalence_best~=0 & cat4_prevalence_best~=.


**controlling for number of agreements

gsort  new_conflictid -agreementdate
duplicates tag new_conflictid, gen (num_agt)
gen num_agt_2= num_agt+1

by new_conflictid: generate running_agt = _n

***Adding Henshaw Leadership and EPR

rename _merge merge16
joinby conflict_id year using "dyadic_data.dta", unmatched(master)

gen anyclaim=.
replace anyclaim=0 if claim==0
replace anyclaim=1 if claim==1|claim==2

gen anyrecruitment=.
replace anyrecruitment=0 if recruitment==0
replace anyrecruitment=1 if recruitment==1|recruitment==2
replace anyrecruitment=. if recruitment==-1

gen anysupport=.
replace anysupport=0 if support==0
replace anysupport=1 if support==1|support==2

drop n_characters n_characters othagr loc1iso loc2iso loc1gwno loc2gwno ucdpagr pamagr gch gchrhet gchantid gchsubs gchoth gdis gdisrhet gdisantid gdissubs gdisoth gage gagerhet gageantid gagesubs gageoth gmig gmigrhet gmigantid gmigsubs gmigoth gra grarhet graantid grasubs graoth gre grerhet greantid gresubs greoth gind gindrhet gindantid gindsubs gindoth goth gothrhet gothantid gothsubs gothoth gref grefrhet grefsubs grefoth gsoc gsocrhet gsocantid gsocsubs gsocoth gewom geme gemenu gemeoth geso gelgbti gelgbtipos gelgbtineg gefa stdef stgen stcon stsd stref stsym stind stuni stbor stxbor pol polgen polnewind polnewtemp conren cons ele eleccomm polpar polpartrans polparoth civso tral pubad polps ppsst ppssub ppsex ppsoro ppsothpr ppsvet ppsaut ppsint ppsoth terps tpssub tpsloc tpsaut tpsoth eps epsres epsfis epsoth mps mpsme mpsjt mpspro mpsoth hrgen eqgen hrdem prot protciv protgrp protlgl prototh hrfra hrfsp hrfbor hrftinc hrfoth hrcp cprlife cprtort cpreq cprslav cprlib cprdet cprfmov cprfspe cprfass cprtria cprpriv cprvote cprreli cproth hrsec serprop serwork serheal seredu serstdl sershel serss sercult seroth hrni hrnime hrnine hrnioth hrii hriimon hriibod hriioth hrmob hrdet med medgov medsubs medlog medoth hrcit citgen citrights citdef citoth juscr juscrsp juscrsys juscrpow jusem jusju juspri justra dev devsoc devhum devinfra nec natres intfu bus tax taxpo taxref taxoth ban cenban banpers banint banxb laref larefman larefret larefoth lanom lach lachta lachit lachpro lachoth laen wat ssrgua ce ceprov cegen ssrpol ssrarm ssrddr ddrdemil ddrprog ssrint ssrpsf ssrff cor ssrcrocr ssrdrugs terr tjgen tjam tjampro tjsan tjpower tjamban tjcou tjjanc tjjaic tjmech tjprire tjvet tjvic tjmis tjrep tjrsym tjrma tjnr imun imoth imref impk ime imsrc merge1 con wggpar wgggenquot wggeffpart wggcitizen wggparoth  wggeqgen  wggeqoth  wggindnom wggrefdisp wggpreg wgggrpoth wggintlaw wgghr wgghrsta wggunsc wggintlawoth wggnewinst wgginstwom wgginf wggrecon wggnewinstoth wggvio wggviosex wggviogen wggvioprot wggviooth wggtrajus wggpast wggpri wggtrajusoth wgginstref wggconst wgglawref wggjud wggpol  wggpubadm wgginstrefoth  wggdevgen   wggrepro wggdevoth wggimpl wggimplrole wggimplsign wggimploth wggoth agreementdate month UcdpCon merge2 female_combatants_best female_combatants_exs female_combatants_high cat4_prevalence_exs cat4_prevalence_high cat4_prevalence_high_exs multiparty conflict_id merge2_2 female_combatants_best_update cat4_prevalence_best_update intensity_level merge3 CountryAbbrev WINGORaw WINGOImputed StartSovereign EndSovereign NAMES_STD countryname WINGORaw_fill merge4 countrycode iso2code nonvprot ibar_ter_cmpt_15up_zs nonvprotestbank allnonprotestGOVT merge5 any uncertainty majorpower thirdparty merge6 country_id country_text_id year_lag historical_date codingstart gapstart gapend codingend  v2x_gender_codehigh v2x_gender_codelow v2x_gender_sd v2x_gencl_codehigh v2x_gencl_codelow v2x_gencs_codehigh v2x_gencs_codelow v2x_genpp v2x_genpp_codehigh v2x_genpp_codelow v2x_genpp_sd startyear merge7  yearlag v2x_gender_lag2 merge8 _merge goalindep goalauto goalrights goalrep goalchange goaldem ideolcom ideolright ideolnat ideolanti ideolrel ideoloth preorgpar preorgmvt internationalized  gen_ddr merge12 cease cease intarmy withd withd milprov intgov intciv elections interrim natalks shagov polprov aut fed ind ref shaloc regdev cul demarcation locgov terrprov amn pris recon return justiceprov reaffirm reaffirmid outlin pko coimpl coimpl active_conflict termdur txt linktofulltextagreement nodyad out_iss out_iss procID frame version dateintervalstartmeta dateintervalendmeta merge13 INDICATOR INDICATOR SUBJECT MEASURE FREQUENCY FlagCodes FlagCodes GEO merge14 merge15 merge15 regionname adminregion adminregionname incomelevel incomelevelname lendingtype lendingtypename

save Thomas_APSR_2023_Appendix.dta, replace

drop contp pp wggeq wggeq wggsoceq wgggrp wggddr wggdev wggrehab wggedu wgghea cowwar v2x_gender v2x_gender v2x_gender_start v2x_gencl_start v2x_gencl_lag2 merge10 ethnic wggddr_binary wggeqgen_binary discrimination_all gen_discrimination gen_exclusion gen_marginalized gen_minority gen_inclusion marginalized_excluded colombia nepal new_conflictid paid region dyad_id dyad_id dyad_name actor_id actor_name incompatibility pa_name pa_date pa_comment pa_sign c_sign pa_3rd c_3rd ended duration c_duration ddr gender inclusive patype UN1325 beijing LOCATION net_ODA ODA_women ODA gwnoa ccode isocode _COWN_ Ratiooffemaletomalelaborfo Adolescentfertilityratebirth lag2 merge16 women_parliament_current low high_moderate none num_agt num_agt_2 running_agt leaders_lt leaders_ht claim recruitment support anyclaim anyrecruitment anysupport 

save Thomas_APSR_2023.dta, replace





